package org.cshoo.sys.business
{
	
	import hessian.client.HessianService;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	
	import org.cshoo.common.business.ServiceLocator;
	import org.cshoo.sys.model.vo.Menu;

	public class MenuDelegate
	{
		public var serviceLocator:ServiceLocator = ServiceLocator.getInstance();
		
		public var _service:HessianService
		private var _responder:IResponder;
		
		public function MenuDelegate(responder:IResponder)
		{
			_service = serviceLocator.menuService;
			this._responder = responder;
		}
		
		public function doSomething(s:String):void
		{
			var asyncToken:AsyncToken　=　_service.getOperation("doSomething").send(s);
			asyncToken.addResponder(_responder);
		}
		
		public function findRootMenuList():void
		{
			var asyncToken:AsyncToken　=　_service.getOperation("findRootMenuList").send();
			asyncToken.addResponder(_responder);
		}
		
		public function findMenuList(menu:Menu):void
		{
			var asyncToken:AsyncToken　=　_service.getOperation("findMenuList").send(menu);
			asyncToken.addResponder(_responder);
		}
		
		public function findMenuListByParent(menuParent:Menu):void
		{
			var asyncToken:AsyncToken　=　_service.getOperation("findMenuListByParent").send(menuParent);
			asyncToken.addResponder(_responder);
		}
		
		public function addMenu(menu:Menu):void
		{
			var asyncToken:AsyncToken = _service.getOperation("addMenu").send(menu);
			asyncToken.addResponder(_responder);	
		}
		
		public function deleteMenu(menu:Menu):void
		{
			var asyncToken:AsyncToken = _service.getOperation("deleteMenu").send(menu);
			asyncToken.addResponder(_responder);	
		}
		
		public function updateMenu(menu:Menu):void
		{
			var asyncToken:AsyncToken = _service.getOperation("updateMenu").send(menu);
			asyncToken.addResponder(_responder);	
		}
	}
}